<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<style>
    div {
        width: 300px;
        height: 300px;
        background-color: pink;
    }

    /* 
        结构伪类选择器 content属性是必须的
    */
    div::before {
        content: "老鼠";

    }

    /* 设置宽高不生效，说明是行内元素 */
    div::after {
        content: "大米";
        background-color: red;
        width: 200px;
        height: 200px;
        /* 转换显示模式 */
        display: block;
    }
</style>

<body>
    <div>爱</div>
</body>

</html>